import java.awt.*;
import java.net.*;
import javax.swing.*;
public class JLabelDemo extends JFrame
{
	
	public JLabelDemo() throws Exception{
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100,100,600,500);
		setTitle("TITLE");
		getContentPane().setBackground(Color.WHITE);
		
		
		JLabel lblBase = new JLabel("这是一个包含文字的标签");
		lblBase.setToolTipText("使用一个字符串来构造");

		Icon icon = new ImageIcon(new URL("http://wenwen.soso.com/p/20110829/20110829112626-329063267.jpg"));
		JLabel lblImage = new JLabel(icon);
		lblImage.setToolTipText("此标签使用了图片链接来构造");

		Container cont = getContentPane();
		
		cont.add(lblBase,BorderLayout.NORTH);
		cont.add(lblImage,BorderLayout.CENTER);
	}
	public static void main(String[] args) throws Exception{
		new JLabelDemo().setVisible(true);	
	}
}
